package com.example.app.Entity;

import static androidx.room.ForeignKey.CASCADE;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;

@Entity(
    tableName = "posts",
    foreignKeys = @ForeignKey(
        entity = User.class,
        parentColumns = "id",
        childColumns = "author_id",
        onDelete = CASCADE
    )
)
public class Post {
    @PrimaryKey(autoGenerate = true)
    private Long id;
    
    @ColumnInfo(name = "author_id")
    private Long authorId;
    
    private String content;
    
    @ColumnInfo(name = "media_urls")
    private String mediaUrlsJson; // 存储为JSON字符串
    
    @ColumnInfo(name = "post_time")
    private Long postTime; // 时间戳
}